import http from "http";

let port = process.env.PORT || 3000;
const server = http.createServer((req, res) => {
  switch(req.url){
    case '/':
      res.writeHead(200, { 'Content-Type': 'text/plain'});
      res.end("Homepage");
      break;
    case '/about':
      res.writeHead(200, { 'Content-Type': 'text/plain'});
      res.end("About");
      break;
    case '/notes':
      res.writeHead(200, { 'Content-Type': 'text/plain'});
      res.end("Notes");
      break;
    default:
      res.writeHead(404, { 'Content-Type': 'text/plain'});
      res.end("404 - Not Found");
      break;
  }
  
});

server.listen(port, () => console.log(`Server started on port ${port};
press Ctrl - C to terminate...`));